// NPC
const mongoose = require('mongoose');
const Schema = mongoose.Schema;

const NpcSchema = new Schema({
    name: {
        type: String,
        required: true
      },
      identity: {// 身份
        type: String,
      },
      now_map: {
        type: Object,
        ref: "maps",
      },
      strength: {// 力量属性
        type: Number,
        required: true,
        default: 0
      },
      defense: {// 体质属性
        type: Number,
        required: true,
        default: 0
      },
      magic: {// 灵力属性
        type: Number,
        required: true,
        default: 0
      },
      speed: { // 速度属性
        type: Number,
        required: true,
        default: 0
      },
      user_exp: { // 灵气值
        type: Number,
        required: true,
        default: 0
      },
      hp: { // 当前生命值
        type: Number,
        required: true,
        default: 100
      },
      max_hp: { // 最大生命值
        type: Number,
        required: true,
        default: 100
      },
      status: { // 当前状态 (0正常，1受伤中)
        type: Number,
        required: true,
        default: 0
      },
      created_at: {     //创建时间
        type: Date,
        default: Date.now()
      },
});

module.exports = Npc = mongoose.model('npcs', NpcSchema);